<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$(".parent").children().hide();
	$(".parent").addClass("pointer").toggle(
		function(){$(this).children().show();
		},function(){$(this).children().hide();}
	);
	$("select").multiselect({height: 260, minWidth: 160});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>制单日期</th>
	<td>
		<input type="text" name="begin_make_time" class="datepicker" value="<?=isset($_GET['begin_make_time']) ? $_GET['begin_make_time'] : date('Y-m-01', CURRENT_TIMESTAMP)?>" /> to
		<input type="text" name="end_make_time" class="datepicker" value="<?=isset($_GET['end_make_time']) ? $_GET['end_make_time'] : date('Y-m-d', CURRENT_TIMESTAMP)?>" />
	</td>
</tr>
<tr>
	<th>发货日期</th>
	<td>
		<input type="text" name="begin_shipped_time" class="datepicker" value="<?=isset($_GET['begin_shipped_time']) ? $_GET['begin_shipped_time'] : ''?>" /> to
		<input type="text" name="end_shipped_time" class="datepicker" value="<?=isset($_GET['end_shipped_time']) ? $_GET['end_shipped_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>网站</th>
	<td>
		<select name="shop_id[]" multiple="multiple">
		<?foreach ($shop_group as $k => $sg):?>
		<optgroup label="<?=$k?>">
		<?foreach ($sg as $s):?>
		<option value="<?=$s['id']?>" <?if (isset($_GET['shop_id']) && in_array($s['id'], $_GET['shop_id'])) echo "selected='selected'"?>><?=$s['name']?></option>
		<?endforeach;?>
		</optgroup>
		<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<th>产品编号</th>
	<td><input type="text" name="product_number" value="<?=isset($_GET['product_number']) ? $_GET['product_number'] : ''?>" /></td>
</tr>
<tr>
	<td><input type="hidden" name="is_search" value="1" /></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<?if (! empty($item)):?>
<table class="list_table" width="100%">
<tr>
	<th width="60">SKU</th>
	<th width="100">ShopItemID</th>
	<th width="100">订单号</th>
	<th>店铺</th>
	<th>售价</th>
	<th width="100">最低售价</th>
	<th width="130">销售日期</th>
	<th width="130">制单日期</th>
	<th width="130">发货日期</th>
</tr>
<?foreach ($item as $i):?>
<tr>
	<td><?=$i['product_basic_number']?></td>
	<td><?=$i['shop_item_id']?></td>
	<td><?=$i['number']?></td>
	<td><?=$i['shop_name']?></td>
	<td><?=$i['currency_symbol']?><?=sprintf('%.2f', $i['sales_price'])?></td>
	<td><?=$i['currency_symbol']?><?=sprintf('%.2f', $i['floor_price']/$i['currency_rate'])?></td>
	<td><?=$i['sales_time']?></td>
	<td><?=$i['make_time']?></td>
	<td><?=$i['shipped_time']?></td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<?endif;?>
<?php $this->_endblock();?>